<template>
    <div>
        <ul>
            <li v-for="(item,i) in list" :key="i" @click="goDetail(item.id)">
                {{item.title}}
            </li>
        </ul>
    </div>
</template>
<script>
export default {
    data(){
        return {
            list:[]
        }
    },
    created(){
        this.$http.get('/api/list').then(res => {
            if(res.data.code === 1){
                this.list = res.data.data;
            }
        })
    },
    methods:{
        goDetail(id){
            // this.$router.push(`/detail/${id}`)
            this.$router.push({path:`/detail/${id}`})
        }
    }
}
</script>
    